Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update design of first published at fields on the new and edit edition pages #8338

Merged

Conversation

davidgisbey
Copy link
Contributor

@davidgisbey davidgisbey commented Oct 9, 2023

Description

We're updating the design of the first published at fields to create less friction for Publishers. Instead of a required field using radio buttons, we now provide a checkbox that if clicked reveals date inputs so the publisher can input the date the document was published externally.

If left unchecked then the behaviour remains the same as if the user had selected the radio stating that the document hasn't been published before.

The main changes in this PR are:

  • move from using Document status radios to a checkbox for the first published fields
  • remove the time fields on both the new and edit page
  • update the feature specs
  • move functionality within a view component and unit test it
  • remove shared controller view_tests which check the correct fields are rendered - there's unit tests for this in the new view component & there's already a bunch of feature specs that test this functionality too

Screenshots

Edit edition page

Before

image

After

image

New edition page

Before

image

After

image image

Figma

https://www.figma.com/file/EUt0D74u7wIspCm8SDBrwH/%5BPublishing-Experience%5D-Navigation?type=design&node-id=585-30877&mode=design

Trello card

https://trello.com/c/4DGKkHgP/1781-change-to-document-status-field

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

@davidgisbey davidgisbey force-pushed the 1781-update-design-of-first-published-section-for-editions branch 7 times, most recently from fad9983 to bee3f9c Compare October 10, 2023 11:39
@davidgisbey davidgisbey marked this pull request as ready for review October 10, 2023 11:44
In order to get this component working it requires the first_published_at
values for day, month and year to be passed in when present. In addition
to whether it has been previously published.

These were previously pulled from the params. As you can get invalid
user input which we want to retain and re-render in the fields, we
can't do something like parsing the datetime from the object/fields
and pass that in as one paramater.
@davidgisbey davidgisbey force-pushed the 1781-update-design-of-first-published-section-for-editions branch from bee3f9c to fc52964 Compare October 10, 2023 11:47
@davidgisbey davidgisbey changed the title Update design of first published at fields Update design of first published at fields on the new and edit edition pages Oct 10, 2023
Copy link
Contributor

@beccapearce beccapearce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Yay for the view components!

This updates the design in a few ways:

1. when the document has not been published on GOV.UK it uses
a checkbox instead of radios
2. removes time from the fields

I've also removed the shared view tests in the shared controller test
helpers testing the correct fields are rendered as this is now covered
in the tests for the component.
At the moment, when a user unchecks the previously published checkbox and
doesn't clear the date inputs, on an unsuccessful save the date inputs
retain the values because they're still present in the params.

This fixes this by pulling the values from the edition_params which
have been cleaned of the values in before actions.

Instead of using #try to check for the presence of the edition params,
I could have added an additional before_action which cleaned the params
as well as the edition params, but i'm a bit loathe to add even more
bloat to the controller.
@davidgisbey davidgisbey force-pushed the 1781-update-design-of-first-published-section-for-editions branch from fc52964 to f3a1e36 Compare October 11, 2023 10:17
@davidgisbey davidgisbey force-pushed the 1781-update-design-of-first-published-section-for-editions branch from 6d7cf98 to 4de37c7 Compare October 11, 2023 14:27
@davidgisbey davidgisbey merged commit 89e6c92 into main Oct 11, 2023
9 checks passed
@davidgisbey davidgisbey deleted the 1781-update-design-of-first-published-section-for-editions branch October 11, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants